package exam.美团笔试;

/**
 * @author chenhong
 * @version 1.0
 * @description TODO
 * @date 2023/4/1 9:31
 */

import java.math.BigDecimal;
import java.util.Scanner;
class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int []nums = new int[n];
        BigDecimal preSum = BigDecimal.valueOf(0);
        for (int i = 0; i < nums.length; i++) {
            nums[i] = scanner.nextInt();
            preSum.add(BigDecimal.valueOf((float)nums[i]));
        }
        int m = scanner.nextInt();
        int []opsIndex = new int[m];
        String []ops = new String[m];
        for (int i = 0; i < m; i++) {
            opsIndex[i] = scanner.nextInt();
            ops[i] = scanner.next();
        }

        for (int i = 0; i < m; i++) {
            int index = opsIndex[i];
            BigDecimal temp = preSum.subtract(BigDecimal.valueOf(nums[index])).subtract(BigDecimal.valueOf(nums[index-1]));
            if(ops[i].equals("+"))
                System.out.printf("%.1f ",preSum);
            else if(ops[i].equals("-"))
                System.out.printf("%.1f ",temp.add(BigDecimal.valueOf(nums[index -1 ] - nums[index])));
            else if(ops[i].equals("*"))
                System.out.printf("%.1f ",temp.add(BigDecimal.valueOf(nums[index -1 ] * nums[index])));
            else
                System.out.printf("%.1f ",temp.add(BigDecimal.valueOf(nums[index -1 ] / nums[index])));

        }
    }
}
